<template>
  <div>
    <script id="editor1" type="text/plain" ></script>
  </div>
</template>

<script>
  import '../../static/ueditor/ueditor.config.js'
  import '../../static/ueditor/ueditor.all.js'
  import '../../static/ueditor/lang/zh-cn/zh-cn.js'
  export default {
    name: "UEditor1",
    props: {
      id: {
          type: String
      },
      config: {
          type: Object
      }
    },
    data() {
      return {
        editor: null
      }
    },
    mounted() {
      //初始化UE
      const _this = this;
      this.editor = UE.delEditor("editor1");
      this.editor = UE.getEditor('editor1',this.config);
    },
    destoryed() {
      this.editor.destory();
    },
    methods:{
      ready:function(callback){
        return this.editor.ready(callback);
      },
      getUEContent: function(){
       return this.editor.getContent();
      },
      setUEContent: function(content,flag){
        if(flag==undefined){
          flag=false;
        }
       return this.editor.setContent(content,flag);
      },
      getContentTxt: function(){
        return this.editor.getContentTxt();
      }
    }
  }
</script>